//
//  BarButton_custm.swift
//  微博框架
//
//  Created by ming on 16/10/4.
//  Copyright © 2016年 ming. All rights reserved.
//

import UIKit
extension UIBarButtonItem{
    //遍历函数
    convenience init?(title:String ,fontSize:CGFloat = 14 ,target: Any?,action: Selector ,isBack:Bool = false) {
        
        //加UIButton，就不需要再解包了
        let button:UIButton = UIButton.cz_textButton(title, fontSize: 14, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
            button.addTarget(target, action: action, for: .touchUpInside)
        if isBack {
          
            button.setImage(UIImage(named:"navigationbar_back_withtext_highlighted"), for: .highlighted)
             button.setImage(UIImage(named:"navigationbar_back_withtext"), for: .normal)
            button.sizeToFit()
        }
        
        self.init(customView: button)
        
    }
}
